RemoveWhere Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Removes all the items in the collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static ICollection<T> RemoveWhere<T>(
	ICollection<T> collection,
	Predicate<T> predicate
)
Visual Basic (Declaration)
Public Shared Function RemoveWhere(Of T) ( _
	collection As ICollection(Of T), _
	predicate As Predicate(Of T) _
) As ICollection(Of T)
Visual C++
public:
generic<typename T>
static ICollection<T>^ RemoveWhere (
	ICollection<T>^ collection, 
	Predicate<T>^ predicate
)

Parameters

collection
ICollection<(Of <T>)>
The collection to check all the items in.
predicate
Predicate<(Of <T>)>
A delegate that defines the condition to check for.

Return Value

Returns a collection of the items that were removed. This collection contains the items in the same order that they orginally appeared in collection.

Type Parameters

T

Remarks

If the collection if an array or implements IList<T>, an efficient algorithm that compacts items is used. If not, then ICollection<T>.Remove is used to remove items from the collection. If the collection is an array or fixed-size list, the non-removed elements are placed, in order, at the beginning of the list, and the remaining list items are filled with a default value (0 or null).

See Also